package cn.edu.fzu.homemaking.company.api;

import cn.edu.fzu.homemaking.company.domain.enums.UserTypeEnum;
import cn.edu.fzu.homemaking.company.domain.enums.SexEnum;
import cn.edu.fzu.homemaking.company.domain.enums.StatusEnum;
import cn.edu.fzu.homemaking.web.Result;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;

@FeignClient(value = "sso")
public interface SsoApi {

    @GetMapping("/api/sso/isLogin")
    Result isLogin();


    @GetMapping("/api/sso/logout")
    Result logout();


    @GetMapping("/api/sso/index")
    Result loginIndex(@RequestParam("sessionId") String sessionId);


    @GetMapping("api/sso/auth/user/info")
    Result getUserInfo();


    @PostMapping("/api/sso/auth/user/updateInfo")
    Result updateUserInfo(@RequestParam("phone") String phone, @RequestParam("address") String address,
                          @RequestParam("faceUrl") String faceUrl,@RequestParam("email") String email);


    @GetMapping("/api/sso/getSessionAttribute")
    Result getSession(@RequestParam("param") String param);


    @GetMapping("/api/sso/setSessionAttribute")
    Result setSession(@RequestParam("key") String key, @RequestParam("value") Object value);


    @PostMapping("/api/sso/auth/user/listCompanyUser")
    Result listCompanyUser(@RequestParam("email") String email, @RequestParam("name") String name,
                           @RequestParam("sex") SexEnum sex, @RequestParam("phone") String phone,
                           @RequestParam("status") StatusEnum status, @RequestParam("companyId") Long companyId,
                           @RequestParam("type") UserTypeEnum type, @RequestParam("labelId") Long labelId,
                           @RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize);


    @GetMapping("/api/sso/auth/user/listAllCompanyUser")
    Result listAllCompanyUser(@RequestParam("type") UserTypeEnum type, @RequestParam("pageNum") Integer pageNum,
                              @RequestParam("pageSize") Integer pageSize);


    @PostMapping("/api/sso/auth/user/addCompanyUser")
    Result addCompanyUser(@RequestParam("email") String email, @RequestParam("password") String password,
                          @RequestParam("name") String name, @RequestParam("sex") SexEnum sex,
                          @RequestParam("birth") String birth, @RequestParam("phone") String phone,
                          @RequestParam("address") String address, @RequestParam("faceUrl") String faceUrl,
                          @RequestParam("labelId") Long labelId, @RequestParam("salary") BigDecimal salary,
                          @RequestParam("type") UserTypeEnum type);


    @PostMapping("/api/sso/auth/user/updateCompanyUser")
    Result updateCompanyUser(@RequestParam("id") Long id, @RequestParam("email") String email,
                             @RequestParam("phone") String phone, @RequestParam("address") String address,
                             @RequestParam("faceUrl") String faceUrl, @RequestParam("status") StatusEnum status,
                             @RequestParam("labelId") Long labelId);

}
